package com.nerivio.util;

import android.content.Context;

import com.meituan.android.walle.WalleChannelReader;
import com.nerivio.BuildConfig;


public class DeviceUtil {
    static String defaultChannel = "pgyer";
    static String cacheChannel = null;

    public static String getChannel(Context context) {
        if (context == null) return null;
        Context applicationContext = context.getApplicationContext();
        //Production multiChannel用于生成多渠道，此时获取渠道信息方式
        if (BuildConfig.FLAVOR_channel.equals("channel")) {
            //有缓存使用缓存
            if (cacheChannel != null) {
                return cacheChannel;
            }
            String channel = WalleChannelReader.getChannel(applicationContext);
            if (channel == null) return defaultChannel;
            cacheChannel = channel;
            return channel;
        }
        return BuildConfig.FLAVOR_channel;

    }
}
